// 更改 Vuex 的 store 中的状态的唯一方法是提交 mutation
// this.$store.commit(method, params)

import store from './'

export default {
  updateLoading(state, status) {
    // clearTimeout(state.loadingTimer);
    // state.loadingTimer = setTimeout(() => {
    state.isLoading = status
    // }, 10)
  },
  hincrement(state, status) {
    // 变更状态
    state.hconfirm = status
  },
  updatePaySection(state, status) {
    console.log("<<>>" + status);
    state.paySection = status
  },
  //退出系统
  hexitSystem(state) {
    state.tokenId = "";
    state.userId = "";
    state.userName = "";
    state.userImg = "";
    state.userInfo = {
      cardId: "",
      mobile: "",
      nickName: "",
      userName: "",
      realNameState: "",
      userHeadUrl: ""
    };
    localStorage.removeItem("tokenId");
    localStorage.removeItem("userId");
    localStorage.removeItem("userName");
    localStorage.removeItem("userImg");
    localStorage.removeItem("userInfo");
  },
  //显示左侧菜单
  showLeftMenu(state) {
    state.show = !state.show;
  },
  //显示左侧菜单
  editFooter(state, index) {
    state.btnactive = index;
  },
  //修改公共参数
  meditcommon(state, v) {
    var strObj = JSON.stringify(state.common);
    var obj = Object.assign(JSON.parse(strObj), v);
    state.common = obj;
    // var obj = Object.assign(state.common,v);
    // state.common=obj;
  }
}

